package com.example.dialog_type;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private MyCompatDialog myCompatDialog;

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.main_btn_open).setOnClickListener(this);
        myCompatDialog = new MyCompatDialog(this);
        Button btn_canale = myCompatDialog.findViewById(R.id.btn_cancle);
        btn_canale.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.btn_cancle) {
            myCompatDialog.cancel();
        } else if (id == R.id.main_btn_open) {
            myCompatDialog.create();
        }
    }
}